<% provide :nav_extras do %>
    <%
      # Cache the value of "can_edit?".  In some cases it will cause us
      # to query GitHub, and we don't want to make duplicate external requests
      @cached_can_edit = can_edit?
    %>

    <%# Section selector dropdown - always visible %>
    <li class="dropdown">
      <a href="#" class="dropdown-toggle" data-toggle="dropdown">
        <%= Icon[:'fa-bookmark'] %><%= t('.section_selector') %><b class="caret"></b>
      </a>
      <ul class="dropdown-menu reverse-dropdown">
        <%
          # Define available sections
          sections = [
            { name: t('projects.form_early.level.0'), level: 'passing' },
            { name: t('projects.form_early.level.1'), level: 'silver' },
            { name: t('projects.form_early.level.2'), level: 'gold' },
            { name: t('projects.edit.permissions_panel_title', default: 'Permissions'), level: 'permissions' }
          ]
          # Future: Add baseline levels here when implemented
        %>
        <% sections.each do |section| %>
          <li class="<%= 'active' if @criteria_level == section[:level] %>">
            <%= link_to section[:name], level_project_path(@project, section[:level]) %>
          </li>
        <% end %>
      </ul>
    </li>

    <% if @cached_can_edit %>
    <li><%= link_to Icon[:'fa-edit'] + t('.edit'), level_edit_project_path(@project, @criteria_level), rel: 'nofollow ugc' %></li>
    <% end %>
    <% if can_control? %>
      <li><%= link_to Icon[:'fa-times-circle'] + t('.delete'), project_path(@project) + '/delete_form', rel: 'nofollow ugc' %></li>
    <% end %>
<% end %>

<div class="row">
  <div class="col-md-2 col-sm-3">
    <div class="main-badge-ques"></div>
  </div>
  <div class="col-md-7 col-sm-6">
    <h1 class="m-t-0 h2"><%=@project.try(:name).presence || '(Name Unknown)' %></h2>
    <%= render "form_#{criteria_level_to_internal(@criteria_level)}", project: @project, view_only: true %>

<div class="row">
<div class="col-md-12">
<strong><%= t '.owned_by' %></strong>
<%= link_to @project.user_display_name, user_path(@project.user_id),
            rel: 'nofollow ugc' %>.<br>
<%= t '.created_at_html', when: @project.created_at %>
<%= t '.updated_at_html', when: @project.updated_at %>
<% if ! @project.lost_passing_at.nil? %>
  <%= t '.last_lost_html', when: @project.lost_passing_at %>
<% end %>
<% if ! @project.achieved_passing_at.nil? %>
  <%= t '.last_achieved_html', when: @project.achieved_passing_at %>
<% end %>
</div>
</div>
